package com.huirui.server.pojo.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Schema(description = "订单信息视图对象")
public class OrderVo {

    @Schema(description = "订单ID", example = "10001")
    private Long orderId;

    @Schema(description = "订单编号", example = "ORD202510190001")
    private String orderNumber;

    @Schema(description = "订单类型（1：普通订单；2：秒杀订单；3：团购订单）", example = "1")
    private Integer orderType;

    @Schema(description = "订单状态（0：待付款；1：已付款；2：已发货；3：已完成；4：已取消）", example = "1")
    private Integer orderStatus;

    @Schema(description = "收货人姓名", example = "张三")
    private String receiverName;

    @Schema(description = "收货人电话", example = "13800138000")
    private String receiverPhone;

    @Schema(description = "支付方式（1：微信支付；2：支付宝；3：银行卡）", example = "1")
    private Integer paymentMethod;

    @Schema(description = "支付时间", example = "2025-10-19T10:30:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime paymentTime;

    @Schema(description = "订单总价（未扣除优惠）", example = "999.00")
    private BigDecimal totalOrderAmount;

    @Schema(description = "实际支付金额（已扣除优惠）", example = "899.00")
    private BigDecimal actualPayment;

    @Schema(description = "用户备注", example = "请在工作日送货")
    private String customerNote;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "订单创建时间", example = "2025-10-19T09:15:00")
    private LocalDateTime createTime;

    @Schema(description = "商家备注", example = "赠品将随主商品一同发出")
    private String merchantNote;

    @Schema(description = "订单详情列表")
    private List<OrderDetailVo> orderDetailVoList;

    @Schema(description = "用户昵称")
    private String userNickname;

    @Schema(description = "用户Id")
    private Long userId;

    @Schema(description = "用户手机号")
    private String userPhoneNumber;

    @Data
    @Schema(description = "订单详情视图对象")
    public static class OrderDetailVo {

        @Schema(description = "订单详情ID", example = "20001")
        private Long orderDetailId;

        @Schema(description = "商品规格图片URL", example = "https://example.com/images/product1.jpg")
        private String productSpecificationImage;

        @Schema(description = "商品名称", example = "华为Mate 60 Pro")
        private String productName;

        @Schema(description = "规格名称")
        private String productSpecificationName;

        @Schema(description = "购买数量")
        private Long quantity;

        @Schema(description = "购买时的价格")
        private Double price;
    }
}
